﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class DataBase_Default : System.Web.UI.Page
{
    BO.News objRegistro;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            validaCohort();
            listaNews();
        }
    }

    private void validaCohort()
    {
        if (Session["cohortAtiva"] == null)
        {
            Response.Redirect("prePage.aspx?redirectUrl=News.aspx");
        }
    }

    private void listaNews()
    {
        if (Session["cohortAtiva"] != null)
        {
            objRegistro = new BO.News();
            objRegistro.objVO.IdUnidade = int.Parse(Session["cohortAtiva"].ToString());
            rptRegistros.DataSource = objRegistro.getTodosRegistroNewsByUnidade();
            rptRegistros.DataBind();
        }
    }
}